package com.competition.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.competition.dao.EquipmentAuditDao;
import com.competition.entity.EquipmentAudit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface EquipmentAuditMapper extends BaseMapper<EquipmentAudit> {
    List<EquipmentAudit> queryEquipmentAuditList(HashMap<String,Object> hashMap);

    @Select("select equipment_leasing.`equipment_name`,equipment_audit.`audit_count`,equipment_leasing.`equipment_price`,equipment_audit.`audit_status`,equipment_leasing.`equipment_imgurl` from equipment_leasing,equipment_audit where \n" +
            " equipment_audit.equipment_id = equipment_leasing.equipment_id and\n" +
            " equipment_audit.`user_id` = #{openid} and\n" +
            "equipment_audit.`audit_status` = #{through} limit #{current},5")
    List<EquipmentAuditDao> selectAllByUserIdAndAuditStatusAndAuditStatus(@Param("openid") String openid, @Param("through") String through,@Param("current")int current);

    @Select("SELECT equipment_leasing.`equipment_name`,equipment_audit.`audit_count`,equipment_leasing.`equipment_price`,equipment_audit.`audit_status`,equipment_leasing.`equipment_imgurl` FROM equipment_leasing,equipment_audit WHERE \n" +
            " equipment_audit.equipment_id = equipment_leasing.equipment_id AND\n" +
            " equipment_audit.`user_id` = = #{openid} AND\n" +
            "equipment_audit.`audit_status` = #{through}  AND\n" +
            "equipment_leasing.`equipment_name` LIKE #{name} \n" +
            "LIMIT #{current},5")
    List<EquipmentAuditDao> selectByMoHu(@Param("openid") String openid, @Param("through") String through,@Param("current")int current,@Param("name") String name);

}
